import { LOGIN, LOGIN_LOGOUT } from '../constants'

const initValue = {
  token: '',
}
export default function login(prevState = initValue, action) {
  switch (action.type) {
    case LOGIN:
      return {
        ...prevState,
        token: action.playload,
      }
    case LOGIN_LOGOUT:
      return {
        ...prevState,
        token: '',
      }
    default:
      return prevState
  }
}
